package com.cn.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @author:王宇航
 * @create: 2023-05-24 22:57
 * @Description:
 */
public class OrderNumberGenerator {
    private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    private static Random random = new Random();

    public static String generate() {
        String datePart = dateFormat.format(new Date());
        int randomPart = random.nextInt(900) + 100; // 生成一个三位随机数
        return datePart + randomPart;
    }

    public static void main(String[] args) {
        System.out.println(generate());
    }
}
